<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <body>

        <ui:composition template="./../pageTemplate.xhtml">

            <ui:define name="content">
                <h3>Nuevo Escaneo</h3>
                <p:separator />
                <div class="contentStyle">
                    <h:form id="scanForm">
                        <p:growl id="scanGrowl" autoUpdate="true" showDetail="true" showSummary="true" />
                        <h:panelGrid id="panelGrid1" columns="2">
                            <h:outputLabel id="outputLabel1" for="inputText1" value="Please enter your name: " />
                            <h:inputText id="inputText1" value="#{scannerBean.name}" required="true" />
                            <h:message id="message1" for="inputText1" />
                            <h:panelGroup id="panelGroup1">
                                <h:commandButton id="commandButton1" value="Forward" type="submit" action="#{scannerBean.forward}" />
                                <h:commandButton id="commandButton2" value="Process" type="submit" action="#{scannerBean.forward}" >
                                    <f:param id="param1" name="target" value="/secured/scanner/scanResults.xhtml" />
                                </h:commandButton>
                            </h:panelGroup>
                            <p:outputLabel for="lista" value="Seleccionar Lista: "  />
                            <p:selectOneMenu id="lista" value="#{scannerBean.selectedProdListList}" 
                                             converter="productListConverter"
                                             style="width: 300px" >
                                <f:selectItem itemLabel="Listas . . ." itemValue="" noSelectionOption="true" />
                                <f:selectItems value="#{productsListsBean.prodListList}" var="aux" 
                                               itemValue="#{aux.id}"
                                               itemLabel="#{aux.nombre}"/>
                            </p:selectOneMenu>
                            <p:outputLabel value="Escanear todas las listas: " />
                            <p:selectBooleanCheckbox value="#{scannerBean.todaslasListas}">
                                <p:ajax update="scanGrowl" listener="#{scannerBean.addMessage}" />
                            </p:selectBooleanCheckbox>
                            <p:outputLabel value="Vulnerabilidades: " />
                            <p:selectOneRadio id="vulns" value="#{scannerBean.tipo}">
                                <f:selectItem itemLabel="Todas" itemValue="1" />
                                <f:selectItem itemLabel="Más Recientes" itemValue="2" />
                            </p:selectOneRadio> 
                            <p:commandButton value="Ejecutar Análisis" 
                                             actionListener="#{scannerBean.ejecutar}" update="resultsPanel"
                                             onclick="PF('execBtn').disable()"
                                             oncomplete="PF('execBtn').enable();PF('resultsPanel').hide()"
                                             widgetVar="execBtn"/>
                        </h:panelGrid>
                        <!--
                        <p:commandButton value="Ejecutar Análisis" type="button" 
                                             onclick="PF('pbAjax').start();PF('executeButton').disable();" widgetVar="executeButton" />
                        <p:progressBar widgetVar="pbAjax" ajax="true" 
                                       value="# {scannerBean.progress}"
                                       labelTemplate="{value}%" >
                            <p:ajax event="complete" listener="# {scannerBean.onComplete}" update="scanGrowl, resultsPanel" 
                                    oncomplete="executeButton.enable();" />
                        </p:progressBar>
                        <p:panel id="resultsPanel" visible="# {scannerBean.escaneoTerminado}">
                            <f:facet name="header">
                                Resultados
                            </f:facet>
                        </p:panel>
                        -->
                        <p:panel id="resultsPanel" styleClass="resultsPanel" visible="#{scannerBean.escaneoTerminado}" >
                            <f:facet name="header">
                                Resultados
                            </f:facet>
                            #{scannerBean.temp}
                        </p:panel>	
                    </h:form>
                </div>
            </ui:define>

        </ui:composition>

    </body>
</html>